﻿<sc:MediaApplicationPage
    x:Class="Subsonic.Pages.AlbumsPivot"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:pc="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:ppc="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls"
    xmlns:sc="clr-namespace:Subsonic.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    ApplicationBar="{StaticResource globalApplicationBar}">

    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="PivotHeaderTemplate">
            <StackPanel Orientation="Vertical">
                <Image HorizontalAlignment="Left" Height="100" Source="{Binding AlbumImage}" Margin="0,20,0,0"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="AlbumsPivotItemTemplate">
            <Grid Margin="0,-20,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                
                <StackPanel Orientation="Horizontal" Grid.Row="0">
                    <TextBlock TextWrapping="Wrap" Text="{Binding Title}" d:LayoutOverrides="Width, Height" Style="{StaticResource PhoneTextSubtleStyle}" Margin="-1,-6,0,3"/>
                </StackPanel>
                <sc:MediaListBox ItemsSource="{Binding Items}" ItemTemplate="{StaticResource NoImageItemListBoxTemplate}" Grid.Row="1" />
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <sc:MediaPivot x:Name="MainPivot" Title="{StaticResource main_apptitle}" ItemsSource="{Binding Pivots}" HeaderTemplate="{StaticResource PivotHeaderTemplate}" ItemTemplate="{StaticResource AlbumsPivotItemTemplate}">
        </sc:MediaPivot>
    </Grid>    
</sc:MediaApplicationPage>